//
// Created by Administrator on 2024-5-10
// 高精度计算--加法
// OJ:https://www.luogu.com.cn/problem/P1601
// https://oj.youdao.com/problem/351?from=problems
//

/*
123+333=456  无进位
123+99=222 有进位 总长度没增加
99+99 = 198 有进位 总长度增加了
99+9999=10098
 */
#include <iostream>

using namespace std;
string addTwoString(string a, string b)
{
    string ret;
    if (a.size() < b.size())
        swap(a, b);
    while (a.size() - b.size() > 0)
        b = "0" + b;
    int len = a.size();
//    cout<<a<<endl;
//    cout<<b<<endl;
    int next = 0;
    for (int i = len - 1; i >= 0; --i)
    {
        int cur = next + a[i] - '0' + b[i] - '0';
        if (cur > 9)
        {
            cur -= 10;
            next = 1;
        } else
            next = 0;
        string t = to_string(cur);
        ret=t+ret;
    }
    if(next==1)
        ret="1"+ret;
    return ret;
}
int main()
{
    string a, b;
    a = "123", b = "333"; // 456
//    a = "123", b = "99";  // 222
    a="99",b="99"; //198
    a="99",b="9999";//10098
//    cin>>a>>b;
    cout << addTwoString(a,b);
    return 0;
}